package com.woniu.controller.frontDoctor;

import com.woniu.controller.BaseController;

import com.woniu.entity.Result;
import com.woniu.pojo.Services;
import com.woniu.pojo.Sign;
import com.woniu.service.IFrontDoctorService;
import com.woniu.vo.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/frontDoctor")
@Api(tags = "前台医生模块")
public class FrontDoctorController extends BaseController {

    @Resource
    private IFrontDoctorService frontDoctorService;

    /**
     * 根据医生的id查询所以的签约订单
     */
    @GetMapping("/doctor/{doctorId}")
    @ApiOperation("根据医生的id查询所以的签约订单")
    public Result querySignByDoctorId(@PathVariable Long doctorId){
       List<SignVo> signList= frontDoctorService.querySignByDoctorId(doctorId);
       return toDataResult(signList);
    }

    /**
     * 审核通过
     */
    @PutMapping
    @ApiOperation("审核签约通过")
    public Result audit(@RequestBody SignVo signVo){
       Boolean flag= frontDoctorService.audit(signVo);
       return toResult(flag);
    }
    /**
     * 根据医生id查询所有服务
     */
    @GetMapping("/service/{doctorId}")
    @ApiOperation("根据医生id查询所有服务")
    public Result queryServicesByDoctorId(@PathVariable Long doctorId){
       List<QueryServiceDetailVo> queryServiceDetailVoList= frontDoctorService.queryServicesByDoctorId(doctorId);
       return toDataResult(queryServiceDetailVoList);
    }
    /**
     * 审核服务
     */
    @PutMapping("/doAudit")
    @ApiOperation("审核服务")
    public Result auditService(@RequestBody QueryServiceDetailVo queryServiceDetailVo){
        Boolean flag= frontDoctorService.auditService(queryServiceDetailVo);
        return toResult(flag);
    }

    /**
     * 服务项目
     */
    @PutMapping("/doService")
    @ApiOperation("服务项目")
    public Result doService(@RequestBody QueryServiceDetailVo queryServiceDetailVo){
        Boolean flag= frontDoctorService.doService(queryServiceDetailVo);
        return toResult(flag);
    }
    /**
     * 驳回签约
     */
    @PutMapping("/refuseSign")
    @ApiOperation("驳回签约")
    public Result refuseSign(@RequestBody SignVo signVo){
        Boolean flag= frontDoctorService.refuseSign(signVo);
        return toResult(flag);
    }
    /**
     * 驳回服务
     */
    @PutMapping("/refuseService")
    @ApiOperation("驳回服务")
    public Result refuseService(@RequestBody QueryServiceDetailVo queryServiceDetailVo){
        Boolean flag= frontDoctorService.refuseService(queryServiceDetailVo);
        return toResult(flag);
    }
}
